<template>
  <div>
     <div class="floor">
       <div class="floor-title">{{floorTitle}}</div>
      <div class="floor_anomaly">
        <div class="floor-one">
          <img :src="floorData0.image" width="100%" alt="">
        </div>
        <div>
          <div class="floor-two">
            <img :src="floorData1.image" width="100%" alt="">
          </div>
          <div >
            <img :src="floorData2.image" width="100%" alt="">
          </div>
        </div>
      </div>
      <div class="floor-rule">
        <div v-for="(item,index) in floorData.slice(3)" :key="index">
          <img :src="item.image" width="100%" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    props:['floorData','floorTitle'],
    // created(){
    //   this.
    // },
    data() {
      return {
        floorData0:{},
        floorData1:{},
        floorData2:{},
      }
    },
    watch:{
      //用watch监听props的数据，解决了异步数据请求的时间差
      //也可以用promise
      floorData:function(e){
        this.floorData0 = this.floorData[0]
        this.floorData1 = this.floorData[1]
        this.floorData2 = this.floorData[2]
      }
    }
  }
</script>

<style scoped>
.floor-title{
  text-align: center;
  font-size: 14px;
  height: 1.8rem;
  line-height: 1.8rem;
}
.floor_anomaly{
    display: flex;
    flex-direction: row;
    background: #fff;
    border-bottom: 1px solid #ddd;
  }
  .floor_anomaly div{
    width: 10rem;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
  }
  .floor-one{
    border-right: 1px solid #ddd;
  }
  .floor-two{
    border-bottom: 1px solid #eee;
  }
  .floor-rule{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    background: #fff;
  }
  .floor-rule div{
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    width: 50%;
    
  }
  .floor-rule div:nth-child(odd){
    border-right: 1px solid #ddd;
  }
</style>